package Common;

/************************************************************************************
* * ��    ��: StaticClass
* * �����ռ䣺Common
* * �������������õľ�̬����

* **********************************************************************************/



/** 
 Public ��ժҪ˵����
*/
public abstract class StaticClass
{
	/** 
	 �����ͻ��˾���Ի���ģ��javascript��alert
	 
	 @param Page ��ǰ��ҳ��� Page �࣬�ڵ���ʱ�� Page ������
	 @param msg Ҫ�������ַ���
	 @return  �޷���ֵ
	*/
	public static void Alert(Page Mypage, String msg)
	{
		if (msg == null)
		{
			return;
		}
		String tempstr = msg.replace("\"","\\\"");
		tempstr = tempstr.replace("\'","\\\'").replace("\n","").replace("\r","");
		StringBuilder sb = new StringBuilder("<script Language=\"Javascript\">");
		sb.append("alert(\"");
		sb.append(tempstr).append("\");");
		sb.append("<").append("/").append("script>");

		if (!Mypage.IsStartupScriptRegistered("msgscript"))
		{
			Mypage.RegisterStartupScript("msgscript",sb.toString());
		}
	}

	/** 
	 ���ص�����Ϣ���ܣ����ض���
	 
	 @param Mypage
	 @param msg
	 @param RedirectURL Ҫ�����ҳ�棬���Ϊ�գ���Ĭ����ҳ
	*/
	public static void Alert(Page Mypage, String msg, String RedirectURL)
	{
		if (msg == null)
		{
			return;
		}
		String tempstr = msg.replace("\"","\\\"");
		tempstr = tempstr.replace("\'","\\\'").replace("\n","").replace("\r","");
		StringBuilder sb = new StringBuilder("<script Language=\"Javascript\">");
		sb.append("alert(\"");
		sb.append(tempstr).append("\");");
		sb.append("document.location='" + RedirectURL + "'"); //Ҫ�����ҳ�棬���Ϊ�գ���Ĭ����ҳ
		sb.append("<").append("/").append("script>");
		if (!Mypage.IsStartupScriptRegistered("msgscript"))
		{
			Mypage.RegisterStartupScript("msgscript",sb.toString());
		}
	}



	/** 
	 ����һ��JavaScript ���롣
	 
	 @param Mypage ��ǰ��ҳ��� Page �࣬�ڵ���ʱ�� Page ������
	 @param script Ҫ���е� JavaScript ����
	*/
	public static void RunJs(Page Mypage, String script)
	{
		if (script == null)
		{
			return;
		}
		StringBuilder sb = new StringBuilder("<script Language=\"Javascript\">");
		sb.append(script);
		sb.append("</script>");

		if (!Mypage.IsStartupScriptRegistered("msgscript"))
		{
			Mypage.RegisterStartupScript("msgscript",sb.toString());
		}
	}

	/** 
	 �����Ի����û�ȷ�Ϻ󣬴�һ��ģʽ���ڣ�ģʽ���ڹرպ���������ת��ĳһҳ�棻ȡ���Ļ�������ԭ���ڣ�״̬����
	 
	 @param Mypage Ĭ��Ϊ��ҳ��Page
	 @param msg ȷ����Ϣ
	 @param ModalDiag ģʽ���ڵĲ���������''�����������
	 @param RedirectURL ��ת��ҳ��
	*/
	public static void Alert(Page Mypage, String msg, String ModalDiag, String RedirectURL)
	{
		if (msg == null)
		{
			return;
		}
		String tempstr = msg.replace("\"","\\\"");
		tempstr = tempstr.replace("\'","\\\'").replace("\n","").replace("\r","");
		StringBuilder sb = new StringBuilder("<script Language=\"Javascript\">");
		sb.append("if (confirm('" + tempstr + "')) ");
		sb.append("{window.showModalDialog(" + ModalDiag + ");");
		sb.append("window.location.href='" + RedirectURL + "';}</script>");
		if (!Mypage.IsStartupScriptRegistered("msgscript"))
		{
			Mypage.RegisterStartupScript("msgscript",sb.toString());
		}
	}

	public static void OpenModalWin(Page Mypage, String Paras)
	{
		if (Paras == null)
		{
			return;
		}
		StringBuilder sb = new StringBuilder("<script Language=\"Javascript\">");
		sb.append("window.showModalDialog(" + Paras + ");");
		sb.append("<").append("/").append("script>");
		if (!Mypage.IsStartupScriptRegistered("msgscript"))
		{
			Mypage.RegisterStartupScript("msgscript",sb.toString());
		}

		//string tmpStr = "window.showModalDialog("+Paras+");";
		//Mypage.Response.Write("<script>"+tmpStr+"</script>");
	}

	public static void RefreshLeftFrame(Page Mypage)
	{
		StringBuilder sb = new StringBuilder("<script Language=\"Javascript\">");
		sb.append("parent.contents.document.location='left.aspx';");

		sb.append("</script>");
	}


	public static void ModelWin(Page Mypage, String ModalDiag, String RedirectURL)
	{
		StringBuilder sb = new StringBuilder("<script Language=\"Javascript\">");
		sb.append("window.showModalDialog(" + ModalDiag + ");");
		sb.append("window.location.href='" + RedirectURL + "';</script>");
		if (!Mypage.IsStartupScriptRegistered("msgscript"))
		{
			Mypage.RegisterStartupScript("msgscript",sb.toString());
		}
	}

	public static void OpenWin(Page Mypage, String Params)
	{
		String tmpStr = "window.open(" + Params + ");";

		Mypage.Response.Write(JsScript(tmpStr));
	}


	public static void OpenWinInCenter(Page Mypage, String pageURL, String pageName, int width, int height, String Params)
	{
		String openScript = "";
		if (Params.equals(""))
		{
			openScript = String.format("window.open('%1$s','%2$s','left='+(screen.width-%3$s)/2+',top='+(screen.height-%4$s)/2+',width=%3$s,height=%4$s');",pageURL,pageName,String.valueOf(width),String.valueOf(height));
		}
		else
		{
			openScript = String.format("window.open('%1$s','%2$s','left='+(screen.width-%3$s)/2+',top='+(screen.height-%4$s)/2+',width=%3$s,height=%4$s,%5$s');",pageURL,pageName,String.valueOf(width),String.valueOf(height),Params);
		}

		String script = "";

		//��֪Ϊ�β���Format
		//script = "if (screen.width < {0} || screen.height < {1}) { alert('��ĵ��Էֱ�������Ӧ��Ϊ��{0} X {1}') } else { {2} } ";
		//script = string.Format(script,width.ToString(),height.ToString(),openScript);

		script = "if (screen.width < " + String.valueOf(width) + " || screen.height < " + String.valueOf(height) + ") { alert('��ĵ��Էֱ�������Ӧ��Ϊ��" + String.valueOf(width) + " X " + String.valueOf(height) + "'); } else { " + openScript + " } ";

		Mypage.Response.Write(JsScript(script));
	}


	/** 
	 ��ϳ�Js Script ��䡣
	 
	 @param S
	 @return 
	*/
	public static String JsScript(String S)
	{
		return "<script>" + S + "</script>";
	}


	/** 
	 ��ʾһ�Ի��Զ���ĶԻ���
	 
	 @param Mypage
	 @param Str �����ȣ�messΪ��ʾ�����ݣ�timesΪ��ʾ��ʱ�䣬urlTransΪҪ���򵽵�url
	*/
	public static void ShowMessage(Page Mypage, String Str)
	{
		if (Str == null || Str.equals(""))
		{
			return;
		}
		Mypage.Response.Redirect("NoteMsg.aspx?" + Str);
	}





	/** 
	 �ж��Ƿ������
	 
	 @param str �Ӵ�
	 @param STR ���ݴ�
	 @return 
	*/
	public static boolean IN(String str, String[] STR)
	{
		for (String a : STR)
		{
			if (str.equals(a))
			{
				return true;
			}
		}
		return false;
	}


	/** 
	 ��ͬһ�����д�һ��ҳ�档
	 
	 @param myPage ��ǰ��ҳ��� Page �࣬�ڵ���ʱ�� Page ������
	 @param PageAndPara ���򿪵�ҳ�漰��Ӧ�Ĵ�?�Ĳ�����
	*/
	public static void OpenPage(Page myPage, String PageAndPara)
	{
		myPage.Response.Redirect(PageAndPara);
	}


	/** 
	 �õ��ļ���չ��
	 
	 @param FileName �ļ�������.txt
	 @return 
	*/
	public static String GetFileExtend(String FileName)
	{
		if (FileName.indexOf(".") < 0)
		{
			return "";
		}
		else
		{
			return FileName.substring(FileName.lastIndexOf(".")).trim();
		}
	}


	/** 
	 �õ��ļ����ļ������֣�������·������
	 
	 @param FileName
	 @return 
	*/
	public static String GetEntireFileName(String FileName)
	{
		if (FileName.indexOf("\\") < 0)
		{
			return FileName;
		}
		else
		{
			return FileName.substring(FileName.lastIndexOf("\\") + 1).trim();
		}
	}


	/** 
	 �ж��ļ��Ƿ���ڣ���������ȫ·�������������·��
	 
	 @param FileName
	 @return 
	*/
	public static boolean FileExists(String FileName)
	{
		java.io.File fileInfo = new java.io.File(FileName);
		return fileInfo.exists();

		// (FileAttributes.Directory in fileInfo.Attributes))
	}

	/** 
	 ��Դ�ļ� Copy ��Ŀ¼�ļ���
	 
	 @param SourceFile Դ�ļ�����ȫ·��
	 @param TargetFile Ŀ���ļ�����ȫ·��
	 @return 
	*/
	public static boolean CopyFile(String SourceFile, String TargetFile)
	{
		try
		{
			java.io.File fileInfo = new java.io.File(SourceFile);
			fileInfo.CopyTo(TargetFile);
			return true;
		}
		catch (java.lang.Exception e)
		{
			return false;
		}

	}

	/** 
	 �жϸ������������Ƿ�Ϊ����.
	 
	 @param S
	 @return 
	*/
	public static boolean IsInt(String S)
	{
		try
		{
			Integer.parseInt(S);
			return true;
		}
		catch (java.lang.Exception e)
		{
			return false;
		}
	}

	public static boolean IsNumber(String S)
	{
		try
		{
			(java.math.BigDecimal)S;
			return true;
		}
		catch (java.lang.Exception e)
		{
			return false;
		}
	}



	/** 
	 �ڸ������ַ��������һ���������ӣ���һ��ʼ��������һλ�����֣����ڻ����ϼ�1��
	 
	 @param S
	 @return 
	*/
	public static String AddIntSeed(String S)
	{
		if ((S == null) || (S.equals("")))
		{
			return "1";
		}
		try
		{
			String sTmp = S.substring(S.length() - 1);
			if (IsInt(sTmp))
			{
				int iTmp = (Integer.parseInt(sTmp) + 1);
				sTmp = S.substring(0,S.length() - 1) + String.valueOf(iTmp).trim();
			}
			else
			{
				sTmp = S + "1";
			}
			return sTmp;
		}
		catch (java.lang.Exception e)
		{
			return S + "888";
		}
	}


	/** 
	 Ӧ������DataGrid��ʽ
	 
	 @param ctr 		
	*/
	public static void ApplyAllDataGridStyle(System.Web.UI.Control ctr)
	{
		//���ڵ���			ctr.Page.Response.Write(ctr.GetType().ToString()+"<br>");

		if (ctr.getClass().toString().equals("System.Web.UI.WebControls.DataGrid"))
		{
			DataGrid dg = (DataGrid)((ctr instanceof DataGrid) ? ctr : null);
			//���ԭ����ʽ
			dg.Style.Clear();
			dg.AlternatingItemStyle.Reset();
			dg.EditItemStyle.Reset();
			dg.ItemStyle.Reset();
			dg.SelectedItemStyle.Reset();
			dg.HeaderStyle.Reset();
			dg.FooterStyle.Reset();
			dg.PagerStyle.Reset();
			//Ӧ���µ���ʽ
			dg.CssClass = "DG";
			dg.AlternatingItemStyle.CssClass = "DGAlternatingItemStyle";
			dg.EditItemStyle.CssClass = "DGEditItemStyle";
			dg.ItemStyle.CssClass = "DGItemStyle";
			dg.SelectedItemStyle.CssClass = "DGSelectedItemStyle";
			dg.HeaderStyle.CssClass = "DGHeaderStyle";
			dg.FooterStyle.CssClass = "DGFooterStyle";
			dg.PagerStyle.CssClass = "DGPagerStyle";

			for (DataGridItem item : dg.Items)
			{
				//���ڵ��ԡ�					ctr.Page.Response.Write(item.ItemType.ToString()+"<br>");
				if (item.ItemType == ListItemType.Item)
				{
					//���ڵ���ctr.Page.Response.Write("mouse"+"<br>");
					item.Attributes.Add("onmouseover","javascript:this.className='DGItemMouseover'");
					item.Attributes.Add("onmouseout","javascript:this.className='DGItemStyle'");
				}
				else if (item.ItemType == ListItemType.AlternatingItem)
				{
					//���ڵ���ctr.Page.Response.Write("mouse"+"<br>");
					item.Attributes.Add("onmouseover","javascript:this.className='DGItemMouseover'");
					item.Attributes.Add("onmouseout","javascript:this.className='DGAlternatingItemStyle'");
				}
				else
				{ //����ѡ��༭�����л��󣬲����js����
					item.Attributes.Remove("onmouseover");
					item.Attributes.Remove("onmouseout");
					//item.Attributes.Clear();
				}
			}
		}
		if (ctr.HasControls())
		{
			for (Control ctrx : ctr.Controls)
			{
				ApplyAllDataGridStyle(ctrx);
			}
		}
	}


	/** 
	 ��dataGird�����ɾ������ʱ���Զ�������ҳ���༭��,��������
	 
	 @param dg Ҫ�����dataGrid
	 @param dt ����ԴdataTable
	 @param IsInsert �����ʽ���������ɾ��
	*/
	public static void DataGridAutoPage(DataGrid dg, DataTable dt, boolean IsInsert)
	{ //���ܵ����һҳҳ��
		int SourceItemCount = dt.Rows.size();
		int MaxPageIndex = (int)Math.ceil((double)SourceItemCount / dg.PageSize) - 1;
		if (MaxPageIndex != -1) //Added By Cosix
		{
			if (IsInsert)
			{
				dg.CurrentPageIndex = MaxPageIndex;
				dg.EditItemIndex = (int)((SourceItemCount - 1) % dg.PageSize);
			}
			else
			{
				//���ɾ���������һҳΨһһ���������CurrentPageIndex
				if (dg.CurrentPageIndex > MaxPageIndex)
				{
					dg.CurrentPageIndex--;
				}
				//ȡ���༭״̬
				dg.EditItemIndex = -1;
			}
		}
		dg.DataSource = dt;
		dt.DefaultView.Sort = null;
		dg.DataBind();
	}

	/** 
	 ���������ַ���
	 
	 @param pToEncrypt Ҫ���ܵ��ַ���
	 @param sKey ��Կ������Ϊ8
	 @return ���ܺ���ַ���
	*/
	public static String Encrypt(String pToEncrypt, String sKey)
	{
		DESCryptoServiceProvider des = new DESCryptoServiceProvider();
		//���ַ����ŵ�byte������  
		//ԭ��ʹ�õ�UTF8���룬�Ҹĳ�Unicode�����ˣ�����  
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: byte[] inputByteArray = Encoding.Default.GetBytes(pToEncrypt);
		byte[] inputByteArray = Encoding.Default.GetBytes(pToEncrypt);
		//byte[]  inputByteArray=Encoding.Unicode.GetBytes(pToEncrypt);  

		//�������ܶ������Կ��ƫ����  
		//ԭ��ʹ��ASCIIEncoding.ASCII������GetBytes����  
		//ʹ�����������������Ӣ���ı�  
		des.Key = ASCIIEncoding.ASCII.GetBytes(sKey);
		des.IV = ASCIIEncoding.ASCII.GetBytes(sKey);
		MemoryStream ms = new MemoryStream();
		CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(),CryptoStreamMode.Write);
		//Write  the  byte  array  into  the  crypto  stream  
		//(It  will  end  up  in  the  memory  stream)  
		cs.Write(inputByteArray, 0, inputByteArray.length);
		cs.FlushFinalBlock();
		//Get  the  data  back  from  the  memory  stream,  and  into  a  string  
		StringBuilder ret = new StringBuilder();
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: foreach(byte b in ms.ToArray())
		for (byte b : ms.ToArray())
		{
			//Format  as  hex  
			ret.append(String.format("%02X", b));
		}
		ret.toString();
		return ret.toString();
	}

	/** 
	 ���������ַ���
	 
	 @param pToDecrypt Ҫ���ܵ��ַ���
	 @param sKey ��Կ������Ϊ8��Ҫ�����ʱʹ�õ���Կ��ͬ
	 @return ���ܺ���ַ���
	*/

	public static String Decrypt(String pToDecrypt, String sKey)
	{
		DESCryptoServiceProvider des = new DESCryptoServiceProvider();

		//Put  the  input  string  into  the  byte  array  
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: byte[] inputByteArray = new byte[pToDecrypt.Length / 2];
		byte[] inputByteArray = new byte[pToDecrypt.length() / 2];
		for (int x = 0; x < pToDecrypt.length() / 2; x++)
		{
			int i = ((int)(pToDecrypt.substring(x * 2, x * 2 + 2), 16));
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: inputByteArray[x] = (byte)i;
			inputByteArray[x] = (byte)i;
		}

		//�������ܶ������Կ��ƫ��������ֵ��Ҫ�������޸�  
		des.Key = ASCIIEncoding.ASCII.GetBytes(sKey);
		des.IV = ASCIIEncoding.ASCII.GetBytes(sKey);
		MemoryStream ms = new MemoryStream();
		CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(),CryptoStreamMode.Write);
		//Flush  the  data  through  the  crypto  stream  into  the  memory  stream  
		cs.Write(inputByteArray, 0, inputByteArray.length);
		cs.FlushFinalBlock();

		//Get  the  decrypted  data  back  from  the  memory  stream  
		//����StringBuild����CreateDecryptʹ�õ��������󣬱���ѽ��ܺ���ı����������  
		StringBuilder ret = new StringBuilder();

		return System.Text.Encoding.Default.GetString(ms.ToArray());
	}

	/** 
	 ���ַ����а������Ŀ�ʼ�������ִ�ȡ�Ӵ�.
	 
	 @param OldStr ԭ�ַ���
	 @param StartStr ��ʼȡ�Ӵ����ַ���
	 @param EndStr ����ȡ�Ӵ����ַ���
	 @param Nearest �Ӵ���ȡ����Ļ�����Զ��
	 @return  ���ؿ�ʼ�Ӵ�������Ӵ�(������)֮����ַ�����
	 ����������������򷴻ؿ��ַ���������Ҳ��������Ӵ�����ôȡ��ԭ������Ϊֹ
	*/
	public static String DenSubstr(String OldStr, String StartStr, String EndStr, boolean Nearest)
	{
		int StartIdx = OldStr.indexOf(StartStr);
		if (StartIdx < 0)
		{
			StartIdx = 0;
		}
		int EndIdx = 0;
		if (Nearest)
		{
			EndIdx = OldStr.indexOf(EndStr);
		}
		else
		{
			EndIdx = OldStr.lastIndexOf(EndStr);
		}
		if (EndIdx < 0)
		{
			EndIdx = OldStr.length();
		}
		try
		{
			return OldStr.substring(StartIdx + 1, StartIdx + 1 + EndIdx - StartIdx - 1);
		}
		catch (java.lang.Exception e)
		{
			return "";
		}
	}


	/** 
	 ���ַ����а���0��ʼ��ȡ�Ӵ�����һ�����ֵĽ�������ֹ��
	 
	 @param OldStr Ҫ��ת�����ַ���
	 @param EndStr ����ȡ�Ӵ����ַ���
	 @return  ���ز�����ȡ�õ��ַ���������������������򷴻ؿ��ַ���
	*/
	public static String DenSubstr(String OldStr, String EndStr)
	{
		int EndIdx = OldStr.indexOf(EndStr);
		if (EndIdx < 0)
		{
			EndIdx = OldStr.length();
		}
		try
		{
			return OldStr.substring(0,EndIdx);
		}
		catch (java.lang.Exception e)
		{
			return "";
		}
	}


	public static String AddThousandSeperator(long number, int decimalLength)
	{
		System.Globalization.NumberFormatInfo nfi = (new System.Globalization.CultureInfo("zh-cn", false)).NumberFormat;
		nfi.NumberDecimalDigits = decimalLength;
		nfi.NumberGroupSeparator = ",";
		return (new Long(number)).toString("N", nfi);
	}

	public static String AddThousandSeperator(java.math.BigDecimal number, int decimalLength)
	{
		System.Globalization.NumberFormatInfo nfi = (new System.Globalization.CultureInfo("zh-cn", false)).NumberFormat;
		nfi.NumberDecimalDigits = decimalLength;
		nfi.NumberGroupSeparator = ",";
		return number.toString("N", nfi);
	}

	public static String AddThousandSeperator(double number, int decimalLength)
	{
		System.Globalization.NumberFormatInfo nfi = (new System.Globalization.CultureInfo("zh-cn", false)).NumberFormat;
		nfi.NumberDecimalDigits = decimalLength;
		nfi.NumberGroupSeparator = ",";
		return (new Double(number)).toString("N", nfi);
	}


	/** 
	 �ڿͻ��˿��Ʒ���˿ؼ�����ʾ/����ʾ ����: BillySir
	 
	 @param controller ������(��Ӧ��HTML�ؼ�������.checked����)
	 @param aim �ܿ���
	 @param visible true - controller.checked==trueʱ��ʾ, 
	 false - controller.checked==falseʱ��ʾ
	*/
	public static void ClientVisible(WebControl controller, WebControl aim, boolean visible)
	{
		controller.Attributes.Add("onclick","visibleCtl(this," + aim.ClientID + "," + String.valueOf(visible).toLowerCase() + ");" + controller.Attributes["onclick"]);
		String VisibleInit = "<script language=\"javascript\">visibleCtl(document.all." + controller.ClientID + ",document.all." + aim.ClientID + "," + String.valueOf(visible).toLowerCase() + ");</script>";
		controller.Page.RegisterStartupScript("VisibleInit" + controller.UniqueID + "_" + aim.UniqueID,VisibleInit);
		controller.Page.RegisterClientScriptBlock("visibleControlFunction","" + "\r\n" +
"				<script language=\"javascript\">" + "\r\n" +
"					function visibleCtl(controller,aim,canView){" + "\r\n" +
"						if(controller.checked==canView){" + "\r\n" +
"							aim.style.display='';" + "\r\n" +
"						}else{" + "\r\n" +
"							aim.style.display='none';" + "\r\n" +
"						}" + "\r\n" +
"					}" + "\r\n" +
"				</script>" + "\r\n" +
"			");
	}
	public static String clientScriptStart = "<script language=\"javascript\">\r\n<!--"; //ע�������ַ�������Ҫ���
	public static String clientScriptEnd = "// -->\r\n</script>";
	public static String jscriptPrefix = "javascript:";
	public static void RegisterGetObject(System.Web.UI.Page page)
	{
		String getObject = "" + "\r\n" +
"function getObject(objectId){" + "\r\n" +
"	if(document.getElementById)" + "\r\n" +
"		return document.getElementById(objectId);" + "\r\n" +
"	else if(document.all&&document.all(objectId))" + "\r\n" +
"		return document.all(objectId);" + "\r\n" +
"	else" + "\r\n" +
"		return false;" + "\r\n" +
"}" + "\r\n" +
"";
		page.RegisterClientScriptBlock("getObject", clientScriptStart + getObject + clientScriptEnd);
	}
	public static void RegisterClientClick(System.Web.UI.Page page)
	{
		String clientClick = "" + "\r\n" +
"function clientEnter(aimId){" + "\r\n" +
"	if (event.keyCode == 13)" + "\r\n" +
"	{" + "\r\n" +
"		event.returnValue=false;" + "\r\n" +
"		event.cancel = true;" + "\r\n" +
"		getObject(aimId).click();" + "\r\n" +
"	}" + "\r\n" +
"}" + "\r\n" +
"";
		page.RegisterClientScriptBlock("clientClick", clientScriptStart + clientClick + clientScriptEnd);
	}
	public static void EnterDefault(WebControl controller, WebControl aim)
	{
		System.Web.UI.Page page = controller.Page;
		RegisterGetObject(page);
		RegisterClientClick(page);
		controller.Attributes.Add("onkeydown",jscriptPrefix + "clientEnter('" + aim.ClientID + "')");
	}
}